<div class="basket">
	<table>
		<tr>
			<td valign="top" width="80%">
			     <div class="container">
        	   		  <?php 
        	   		      $escaper = new Zend\Escaper\Escaper('utf-8');
        	   		  
        	   		      echo sprintf('<div class="title">%s</div>', $this->translate('basket', 'catalog', $this->locale));
        	   		  ?>
        	   		  <hr>
        	   		  <?php 
        	   		      if (count($this->basket['items']) == 0) { 
                              echo '<div class="continue_shopping">';
                              echo sprintf('<div >%s</div>', $this->translate('empty basket', 'catalog', $this->locale));
                              echo sprintf('<a href="%s" class="button">%s</a>', $this->url('catalog/home', array('controller' => 'home', 'action' => 'home'), array(), true),
                                     $this->translate('continue shopping', 'catalog', $this->locale));
                              echo '</div>';
                          } else { 
        	   		  ?>
            	   		  <table>
            	   		      <thead>
            	   		          <tr>
            	   		              <th width="60%">
            	   		                  <?php echo $this->translate('basket product', 'catalog', $this->locale); ?>
            	   		              </th>
            	   		              <th width="20%">
            	   		                  <?php echo $this->translate('basket quantity', 'catalog', $this->locale); ?>
            	   		              </th>
            	   		              <th width="20%">
            	   		                  <?php echo $this->translate('basket price', 'catalog', $this->locale); ?>
            	   		              </th>
            	   		              <th width="5%">
            	   		              </th>
        	   		              </tr>
            	   		      </thead>
            	   		      <?php 
            	   		          foreach ($this->basket['items'] as $item): {
                                        $itemId = $item->getId();
                                        $price = $item->getPrice();
                                        $quantity = $item->getQuantity();
                                        $imageUrl = $item->getImageUrl();
                                        $deleteActionUrl = $this->url('catalog/basket', array('action' => 'delete', 'controller' => 'basket'), array(), true);
    
                                        // Compose description with product attributes
                                        $description = $escaper->escapeHtml($item->getDescription());
                                        $attributes = Zend\Json\Json::decode($item->getAttributes());
                                        
                                        for ($i = 0; $i < count($attributes); $i++)
                                             $description = $description . sprintf('<div class="attribute">%s : %s</div>', $escaper->escapeHtml($attributes[$i]->name), $escaper->escapeHtml($attributes[$i]->attribute_value_name));
                                        
                                        echo sprintf('<tr class="item"><td><img src="%s" /><div class="description">%s</div></td><td><div class="quantity">%s</div></td><td><div class="price">%s</div></td><td><form action="%s" method="POST"><input class="delete" value="" type="submit" /><input name="item_id" type="hidden" value="%s" /></form></td></tr>', $escaper->escapeHtmlAttr($imageUrl), $description, 
                                                $quantity, $this->currencyFormat($price, $this->basket['basket']->getCurrency(), $this->locale), $deleteActionUrl, $itemId);
            	   		          } endforeach;
            	   		      ?>
            	   		  </table>
            	   		  <hr>
            	   		  <div class="total">
            	   		      <?php 
            	   		          echo sprintf('<div>%s : %s</div>', $this->translate('total', 'catalog', $this->locale), $this->currencyFormat($this->basket['basket']->getTotal(), $this->basket['basket']->getCurrency(), $this->locale));
            	   		          echo sprintf('<a href="%s" class="button">%s</a>', $this->url('user/checkout', array('controller' => 'checkout', 'action' => 'summary'), true), $this->translate('checkout', 'catalog', $this->locale))
            	   		      ?>
            	   		  </div>
            	       <?php } ?>
    	   		  </div>
			</td>
			<td valign="top" width="20%">
                <?php
                    echo $this->callout(null, array(
                        'title' => $this->translate('personalize', 'catalog', $this->locale),
                        'content' => $this->translate('personalize_content', 'catalog', $this->locale),
                        'imageUrl' => $this->basePath() . '/img/callout/personalize.png'
                    ));
                    
                    echo $this->callout(null, array(
                        'title' => $this->translate('collaborate', 'catalog', $this->locale),
                        'content' => $this->translate('collaborate_content', 'catalog', $this->locale),
                        'imageUrl' => $this->basePath() . '/img/callout/collaborate.png'
                    ));
                    
                    echo $this->social_callout(null, null);
                    echo $this->paypal_callout(null, null);
                ?>
            </td>
		</tr>
	</table>
</div>